import re
from my_package import my_tools

# \d:数字
# 检测字符串是否为纯数字的字符串
result = re.match(r'^\d+$', '123456a')  # ^和$起始和结尾，在这里起始和结尾都要为数字开可以匹配成功
print(result)
# \w：字母数字下划线
result = re.match(r'\w+', 'Abbot_crane1*')
print(result)
# \s:空白符 \S 非空
result = re.match(r'\s+', '  ')
print(result)
# .任意字符
result = re.match(r'^code\d-\d-.+$', 'code1-2-function')
print(result)
# []区间，可选列表
result = re.match(r'^abc{2,5}$', 'abccc')  # 表示后面的字符c可以有2~5个
print(result)
# | 或者
result = re.match(r'^a|b|c$', 'd')
print(result)
# 身份证号码匹配
result = re.match(r'^\d{6}((20[012]\d)|(1[89]\d\d))\d{7}(\d|X)$', '440981200602126838')
print(result)
# 手机号匹配
result = re.match(r'^1\d{10}$', '15948294720')
print(result)

print(my_tools.is_id_number('440981200602126838'))
print(my_tools.is_phone_number('15948294720'))